package com.ztgf.shopping.service.shop;

import java.util.Date;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.shopping.common.config.YmlConfig;
import com.ztgf.shopping.mapper.shop.ShopBrowseRecordingMapper;
import com.ztgf.shopping.models.dto.shop.ShopBrowseRecordingDTO;
import com.ztgf.shopping.models.service.shop.IShopBrowseRecordingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/*
 * @author: chenyu.wang
 * @date: 2020-09-04
 * @description:
 */
@Slf4j
@DubboService
public class ShopBrowseRecordingServiceImpl extends ServiceImpl<ShopBrowseRecordingMapper, ShopBrowseRecordingDTO> implements IShopBrowseRecordingService {

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public void add(ShopBrowseRecordingDTO dto) {
        ShopBrowseRecordingDTO browseRecordingDTO = new ShopBrowseRecordingDTO();
        browseRecordingDTO.setShopId(dto.getShopId());
        browseRecordingDTO.setIp(dto.getIp());
        browseRecordingDTO.setUri(dto.getUri());
        browseRecordingDTO.setActionName(dto.getActionName());
        browseRecordingDTO.setParams(dto.getParams());
        browseRecordingDTO.setId(ymlConfig.getPkId());
        boolean insert = this.insert(browseRecordingDTO);
        if (insert) {
            log.info("保存店铺浏览记录表成功!");
        } else {
            log.info("保存店铺浏览记录表成功!");
        }

    }
}
